#ifndef ZIMAGE_H_
#define ZIMAGE_H_

#include <Common/GlobalDefines.h>
#include <opencv2/opencv.hpp>

GLOBAL_NAMESPACE_BEGIN

//namespace MLAlgorithms
//{
//    class ImageFeature;
//}

namespace ImageSpace
{
    class Image
    {
    public:
        enum ImageType {
            IMAGE_Default = 0,
            IMAGE_Template,
            IMAGE_Mask
        };
    public:
        Image(const ImageType type = IMAGE_Default, Image* refIma=NULL, const std::string& outFolder=std::string(""));
        ~Image();

        // IO
        bool        loadImageFromFile(const char* fileName);
        bool        saveImageToFile(const char* fileName);
        void        setId(int id);
        size_t      getDimension();
        void        getData(double* dest);

        cv::Mat*            getData();
        const cv::Mat*      getData() const;
        std::string         getName();
        const std::string   getName() const;
        std::string         getFullPath();
        const std::string   getFullPath() const;
        int                 getId();
        int                 getId() const;
        ImageType           getType();
        const ImageType     getType() const;

        //
        void setData(const cv::Mat& data);
        void setName(const std::string& name);
        void setFullPath(const std::string& fullname);
        void setType(ImageType type);

        // op
        Image* resize(int width, int height);

        //void setFeature(MLAlgorithms::ImageFeature* feature);
        // this function should be called after the id has been set
        void modifyTheName();

    private:
        cv::Mat data_;
        ImageType type_;
        std::string imageName_;
        std::string imageFullPath_;
        int id_;

        //MLAlgorithms::ImageFeature* feature_;
    };
}

GLOBAL_NAMESPACE_END

#endif//ZIMAGE_H_